home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / 第1特集Plug-in / Photoshop / Developer's Kit.sit / Developer's Kit / Documentation / Text versions / Export next >
Internet Message Format  |  1993-05-07  |  10KB

  1. Date: 07 May 93 16:12 GMT
  2. From: ABRAHAM@AppleLink.Apple.COM (Ohlendorf Research,PAS) Subject: Export module ohlendorf
  3. To: WAYNE@helix.nih.gov
  4.  
  5. Export Module Interface for Adobe Photoshop(tm) 
  6.  
  7. (c)1990-91 Thomas Knoll
  8.  
  9. Introduction
  10.  
  11. This document describes version 4 of Adobe Photoshop's export module interface. Plug-ins based on the following specifications should contain a 4 in their `PiMI' resource.
  12.  
  13. If the plug-in does not use the fields after the version 4 fields comment, it may choose to label itself a version 3 plug-in, to remain compatible with older versions of host software.
  14.  
  15. The code resource and file type for export modules is `8BEM'. 
  16.  
  17. Record Structure
  18.  
  19. The stuff parameter contains a pointer to a structure of the following type: 
  20.  
  21. ExportRecord = RECORD
  22.  
  23. serialNumber: LONGINT;
  24. abortProc: ProcPtr;
  25. progressProc: ProcPtr;
  26. maxData:LONGINT;
  27. imageMode: INTEGER;
  28. imageSize: Point;
  29. depth: INTEGER;
  30. planes: INTEGER;
  31. imageHRes: Fixed;
  32. imageVRes: Fixed;
  33. redLUT: PACKED ARRAY [0..255] OF CHAR;
  34. greenLUT: PACKED ARRAY [0..255] OF CHAR; blueLUT:PACKED ARRAY [0..255] OF CHAR;
  35. theRect:Rect;
  36. loPlane:INTEGER;
  37. hiPlane:INTEGER;
  38. data: Ptr;
  39. rowBytes: LONGINT;
  40. filename: Str255;
  41. vRefNum:INTEGER;
  42. dirty: BOOLEAN;
  43. selectBBox: Rect;
  44.  
  45. { Version 4 fields }
  46. hostSig:OSType; hostProc: ProcPtr;duotoneInfo:Handle; thePlane: INTEGER; monitor: ExportMonitor;
  47.  
  48. reserved: PACKED ARRAY [0..255] OF CHAR; 
  49.  
  50. END;
  51.  
  52. ExportMonitor = RECORD
  53. gamma: Fixed; redX: Fixed; redY: Fixed;
  54. greenX: Fixed; greenY: Fixed; blueX: Fixed; blueY: Fixed; whiteX: Fixe whiteY:Fixed;
  55. ambient:Fixed; END;
  56.  
  57. Calling Order
  58.  
  59. When the user invokes the plug-in by selecting its name from the Export submenu, Photoshop loads the plug-in's resource into memory and calls it with the following sequence of selector values (see the header file for their actual values):
  60.  
  61. (1) exportSelectorPrepare
  62.  
  63. This allows the plug-in to adjust Photoshop's memory allocation algorithm. Before this call, Photoshop sets the maxData field to the maximum number of bytes it would be able to free up. If plug-in module then has the option of reducing this number during this call. Reducing the number can speed up operation, since freeing up the maximum amount of memory requires Photoshop to move all of the image data for any currently open images out of of RAM and into its virtual memory file.
  64.  
  65. If the plug-in knows that it memory requirements will be limited (if it can process the image data in strips, or if the maximum resolution image it can process is small), it should reduce maxData to its actual requirements during this call. This will allow small exports to be performed entirely in RAM. 
  66.  
  67. If, as is often the case, the plug-in only needs a small amount memory, but will operate faster if given more, a tradeoff has to be made. One solution is to divide the maxData field by 2, thus allocating half the memory to Photoshop and half to the plug-in.
  68.  
  69. (2) exportSelectorStart
  70.  
  71. Most plug-ins will display their dialog box, if any, during this call. 
  72.  
  73. During this call, the plug-in should set theRect and the loPlane and hiPlane fields to let Photoshop know what area of the image it wishes to process first. 
  74.  
  75. The total number of bytes requested should be less than maxData. If the image is larger than maxData, the plug-in must process the image in strips. Horizontal strips are most efficient, but any pattern is allowed (even overlapping ones).
  76.  
  77. (3) exportSelectorContinue
  78.  
  79. During this routine, the plug-in should process the image data pointed to by the data field.
  80. It should then adjust theRect and the loPlane and hiPlane fields to let Photoshop know what area of the image it wishes to process next. If the entire image has been processed, it should set theRect to an empty rectangle. 
  81.  
  82. The requested image data is pointed to by the data field. If more than one plane has been requested (loPlane - hiPlane), the data is interleaved. The offset from one row to the next is indicated by the rowBytes field. This is not necessarily equal to the width of theRect-there may be additional pad bytes at the end of each row.
  83.  
  84. (4) exportSelectorFinish
  85.  
  86. This call allows the plug-in to clean up after an image export. This call is made if and only if the exportSelectorStart routine returns without error (even if the exportSelectorContinue routine returns an error). 
  87.  
  88. If Photoshop detects a command-period between calls to the exportSelectorContinue routine, it will call the exportSelectorFinish routine (be careful here, since normally the plug-in would be expecting another exportSelectorContinue call).
  89.  
  90. Record Fields
  91.  
  92. (1) serialNumber
  93.  
  94. Contains Adobe Photoshop's serial number. Plug-in modules can use this value for copy protection, if desired.
  95.  
  96. (2) abortProc
  97.  
  98. Contains a pointer to a function with the following Pascal calling conventions: 
  99.  
  100. FUNCTION TestAbort: BOOLEAN;
  101.  
  102. The plug-in may call this function several times a second during long operations to allow the user to abort the operation. If the function returns TRUE, the operations should be aborted. As a side effect, this changes to cursor to a watch, and moves the watch hands periodically. 
  103.  
  104. (3) progressProc
  105.  
  106. Contains a pointer to a procedure with the following Pascal calling conventions:
  107.  
  108. PROCEDURE UpdateProgress (done, total: LONGINT); 
  109.  
  110. The plug-in may call this two-argument procedure periodically to update a progress indicator. The first parameter is the number of operations completed; the second is the total number of operations. 
  111.  
  112. This procedure should only be called during the actual main operation of the plug-in, not during long operations during the preliminary user interface. 
  113.  
  114. Photoshop automatically suppresses display of the progress graph during short operations.
  115.  
  116. (4) maxData
  117.  
  118. Photoshop initializes this field to the maximum of number of bytes it can free up. The plug-in may reduce this value during the exportSelectorPrepare routine. The exportSelectorContinue routine should process the image in strips no larger than maxData, less the size of any large tables or scratch areas it has allocated.
  119.  
  120. (5) imageMode
  121.  
  122. The mode of the image being exported (Gray Scale, RGB Color, etc.). See the header file for possible values. The exportSelectorStart should return an exportBadMode error if it is unable to process this mode of image. 
  123.  
  124. (6) imageSize
  125.  
  126. The image's width (imageSize.h) and height (imageSize.v) in pixels. 
  127.  
  128. (7) depth
  129.  
  130. The image's resolution in bits per sample. The only possible settings are 1 for bitmap mode images, and 8 for all other modes. 
  131.  
  132. (8) planes
  133.  
  134. The number of channels in the image. For example, if an RGB image without alpha channels is being processed, this field will be set to 3. 
  135.  
  136. (9) imageHRes and imageVRes
  137.  
  138. The image's horizontal and vertical resolution in terms of pixels per inch. These are fixed point numbers (16 binary digits). 
  139.  
  140. (10) redLUT, greenLUT and blueLUT
  141.  
  142. If an indexed color or duotone mode image is being processed, these fields will contain its color table.
  143.  
  144. (11) theRect
  145.  
  146. The exportSelectorStart and exportSelectorContinue routines should set this field to request an area of the image for processing. Should be set to an empty rectangle when complete.
  147.  
  148. (12) loPlane and hiPlane
  149.  
  150. The exportSelectorStart and exportSelectorContinue routines should set these fields to the first and last planes to process next. 
  151.  
  152. (13) data
  153.  
  154. This field contains a pointer to the requested image data. If more than one plane has been requested (loPlane - hiPlane), the data is interleaved. 
  155.  
  156. (14) rowBytes
  157.  
  158. The offset between rows for the requested image data. 
  159.  
  160. (15) filename
  161.  
  162. The name of the file the image was read from. File exporting modules should use this field as the default name for saving. 
  163.  
  164. (16) vRefNum
  165.  
  166. The volume reference number of the file the image was read from. 
  167.  
  168. (17) dirty
  169.  
  170. File exporting modules should clear this field to prevent to the user being prompted to save any unsaved changes when the image is eventually closed. 
  171.  
  172. (18) selectBBox
  173.  
  174. The bounding box of the current selection. If there is no current selection, this is an empty rectangle.
  175.  
  176. (19) hostSig
  177.  
  178. The host program's signature. Photoshop's signature is `8BIM'. 
  179.  
  180. (20) hostProc
  181.  
  182. A host-defined callback procedure that can do anything the host wishes. Plug-ins should verify the hostSig before calling this procedure. This provides a mechanism for hosts to extend the plug-in interface to support application specific features.
  183.  
  184. (21) duotoneInfo
  185.  
  186. When exporting a duotone mode image, the host allocates a handle in fills in the duotone information. The format of the information is the same as that required by acquisition modules, and should be treated as a black box by plug-ins.
  187.  
  188. (22) thePlane
  189.  
  190. Currently selected channel, or -1 if a composite color channel, or -2 if all channels.
  191.  
  192. (23) monitor
  193.  
  194. Information on the current monitor. The gamma field contains the monitor's gamma value, or zero if the entire monitor record is undefined. The redX, redY, greenX, greenY, blueX, blueY fields specify the chromaticity coordinates of the monitor's phosphors. The whiteX and whiteY fields specify the chromaticity coordinates of the monitor's white point. The ambient value specifies the relative amount of ambient light in the room. Zero means a relatively dark room, 0.5 means an average room, and 1.0 means a bright room. 
  195.  
  196. (24) reserved
  197.  
  198. Set to zero by the host for future expansion of the plug-in standard. Must not be used by plug-ins.
  199.  
  200. Supporting Older Plug-in Versions
  201.  
  202. This section describes how hosts can be compatible with older versions of the plug-in specification. It is of interest only to authors of host software. 
  203.  
  204. (1) If the version is less than 3, do not call the exportSelectorPrepare routine.
  205.  
  206. (2) If the version is less than 4, Duotone mode images are exported a single channel Indexed Color mode images
  207.  
  208. All other changes are backward compatible. 
  209.  
  210.  
  211.  
  212.